# Contributor: Frank Hunleth <fhunleth@troodon-software.com>
# Maintainer: Frank Hunleth <fhunleth@troodon-software.com>
pkgname=fwup
pkgver=1.8.0
pkgrel=0
pkgdesc="Configurable embedded Linux firmware update creator and runner"
url="https://github.com/fhunleth/fwup"
arch="all"
license="Apache-2.0"
makedepends="linux-headers confuse-dev libarchive-dev help2man dosfstools mtools zip unzip xdelta3"
subpackages="$pkgname-doc $pkgname-bash-completion:bashcomp:noarch"
source="$pkgname-$pkgver.tar.gz::https://github.com/fhunleth/fwup/releases/download/v$pkgver/fwup-$pkgver.tar.gz"

build() {
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--localstatedir=/var
	make
}

check() {
	make check
}

package() {
	make DESTDIR="$pkgdir" install
}

bashcomp() {
	depends=""
	pkgdesc="Bash completions for $pkgname"
	install_if="$pkgname=$pkgver-r$pkgrel bash-completion"

	mkdir -p "$subpkgdir"/usr/share/bash-completion/completions
	mv "$pkgdir"/usr/share/bash-completion/completions/* \
		"$subpkgdir"/usr/share/bash-completion/completions
}

sha512sums="6842cc141bc5b86457ca11ad176cddf552b90f3edd46f7d823a4169756b0ba36776a860fcdd89ce0f263b91e1977d8ef183dc1aa721cfffe7fe893dc40fad8bd  fwup-1.8.0.tar.gz"
